package com.gingko.duominuo.viewmodel

import androidx.hilt.Assisted
import androidx.hilt.lifecycle.ViewModelInject
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.SavedStateHandle
import com.gingko.duominuo.data.Resource
import com.gingko.duominuo.data.asResource
import com.gingko.duominuo.data.source.repository.GinkgoRepository

class SplashViewModel @ViewModelInject constructor(
    private val ginkgoRepository: GinkgoRepository,
    @Assisted val state: SavedStateHandle
) : BaseViewModel() {
    private val _loadStateLiveData = MutableLiveData<Boolean>()
    val loadStateLiveData: LiveData<Boolean> = _loadStateLiveData

    fun loadNameMapping() {
        launchOnUI(
            task = {
                ginkgoRepository.getTaskFilter()
            }, onComplete = {
                _loadStateLiveData.postValue(true)
            },
            isShowLoading = false
        )
    }

}